﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TSL.AjaxResult.KaiJiang
{
    public class KaiJiang1
    {
        public static int DaXiaoDS(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            string _mycode = string.Empty;
            int win = 0;
            int winbonus = 0;
            int DX = 9;
            int DS = 9;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 3].ToString().Trim();
                    if (Convert.ToInt32(_code) > 5)
                    {
                        DX = 1;
                    }
                    else
                    {
                        DX = 0;
                    }
                    if ((Convert.ToInt32(_code) % 2) == 0)
                    {
                        DS = 2;
                    }
                    else
                    {
                        DS = 3;
                    }
                    _mycode = mycodes[j].ToString().Trim();
                    if (((_mycode.IndexOf(DX.ToString()) != -1) || (_mycode.IndexOf(DS.ToString()) != -1)) && (mycodes.Length == 2))
                    {
                        win++;
                    }
                }
                if (win == 2)
                {
                    winbonus += win;
                }
            }
            return winbonus;
        }

        public static int DWD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycodes[j].ToString().Trim().IndexOf(_code) != -1) && (mycodes.Length == 5))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int GeWeiHZ(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 4].ToString().Trim();
                    if ((mycodes[j].ToString().Trim().IndexOf(_code) != -1) && (mycodes.Length == 1))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int HouErZUE(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            if (code[3].ToString() != code[4].ToString())
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    mycodes = mycode[i].ToString().Trim();
                    for (int j = 0; j < 2; j++)
                    {
                        _code = code[j + 3].ToString().Trim();
                        if (mycodes.IndexOf(_code) != -1)
                        {
                            win++;
                        }
                    }
                    if (win == 2)
                    {
                        winbonus++;
                    }
                }
            }
            return winbonus;
        }

        public static int HouErZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode1 = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode1.Length; i++)
            {
                win = 0;
                string[] mycode3 = mycode1[i].ToString().Trim().Split(new char[] { ',' });
                for (int j = 0; j < mycode3.Length; j++)
                {
                    _code = code[j + 3].ToString().Trim();
                    if ((mycode3[j].ToString().Trim().IndexOf(_code) != -1) && (mycode3.Length == 2))
                    {
                        win++;
                    }
                }
                if (win == 2)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int HouErZXD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString();
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 3].ToString().Trim();
                    if ((mycodes.Substring(j, 1).IndexOf(_code) != -1) && (mycodes.Length == 2))
                    {
                        win++;
                    }
                }
                if (win == 2)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int HouSanHunZU(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                string singlenum = mycode[i].ToString().Trim();
                if (((singlenum.Substring(0, 1) == singlenum.Substring(1, 1)) || (singlenum.Substring(0, 1) == singlenum.Substring(2, 1))) || (singlenum.Substring(2, 1) == singlenum.Substring(1, 1)))
                {
                    win = HouSanZUS(codes, mycode[i].ToString().Trim());
                }
                else
                {
                    win = HouSanZUL(codes, mycode[i].ToString().Trim());
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int HouSanZHH(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            int win = 0;
            int winbonus = 0;
            int zhihe = 0x63;
            zhihe = (Convert.ToInt32(code[3]) + Convert.ToInt32(code[2])) + Convert.ToInt32(code[4]);
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    if (Convert.ToInt32(mycodes[j].ToString().Trim()) == zhihe)
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int HouSanZUH(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            int ZXHZ = 0;
            bool zuhe = false;
            bool flag = false;
            if (((Convert.ToInt32(code[4]) == Convert.ToInt32(code[3])) || (Convert.ToInt32(code[4]) == Convert.ToInt32(code[2]))) || (Convert.ToInt32(code[2]) == Convert.ToInt32(code[3])))
            {
                zuhe = true;
                ZXHZ = (Convert.ToInt32(code[2]) + Convert.ToInt32(code[2])) + Convert.ToInt32(code[4]);
            }
            if (flag)
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    string[] mycodes = mycode[i].Split(new char[] { ',' });
                    for (int j = 0; j < mycodes.Length; j++)
                    {
                        _code = code[j + 4].ToString().Trim();
                        if (Convert.ToInt32(mycodes[j].ToString().Trim()) == ZXHZ)
                        {
                            win++;
                        }
                    }
                    winbonus += win;
                }
            }
            if (!zuhe)
            {
                winbonus = 0;
            }
            return winbonus;
        }

        public static int HouSanZUL(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            bool zuliu = false;
            int win = 0;
            int winbonus = 0;
            if (((code[2] != code[3]) && (code[2] != code[4])) && (code[3] != code[4]))
            {
                zuliu = true;
            }
            if (zuliu)
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    mycodes = mycode[i].ToString().Trim();
                    for (int j = 0; j < 3; j++)
                    {
                        _code = code[j + 2].ToString().Trim();
                        if (mycodes.IndexOf(_code) != -1)
                        {
                            win++;
                        }
                    }
                    if (win == 3)
                    {
                        winbonus++;
                    }
                }
            }
            if (!zuliu)
            {
                winbonus = 0;
            }
            return winbonus;
        }

        public static int HouSanZUS(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            bool zuxuan = false;
            if (((Convert.ToInt32(code[3]) == Convert.ToInt32(code[2])) || (Convert.ToInt32(code[2]) == Convert.ToInt32(code[4]))) || (Convert.ToInt32(code[4]) == Convert.ToInt32(code[3])))
            {
                zuxuan = true;
            }
            if ((Convert.ToInt32(code[2]) == Convert.ToInt32(code[3])) && (Convert.ToInt32(code[2]) == Convert.ToInt32(code[4])))
            {
                zuxuan = false;
            }
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString().Trim();
                for (int j = 0; j < 3; j++)
                {
                    _code = code[j + 2].ToString().Trim();
                    if (mycodes.IndexOf(_code) != -1)
                    {
                        win++;
                    }
                }
                if (zuxuan && (win == 3))
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int HouSanZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode1 = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode1.Length; i++)
            {
                win = 0;
                string[] mycode3 = mycode1[i].ToString().Trim().Split(new char[] { ',' });
                for (int j = 0; j < mycode3.Length; j++)
                {
                    _code = code[j + 2].ToString().Trim();
                    if ((mycode3[j].ToString().Trim().IndexOf(_code) != -1) && (mycode3.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int HouSanZXD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString();
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 2].ToString().Trim();
                    if ((mycodes.Substring(j, 1).IndexOf(_code) != -1) && (mycodes.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int HouYiZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int winbonus = 0;
            int win = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 4].ToString().Trim();
                    if ((mycodes[j].ToString().Trim().IndexOf(_code) != -1) && (mycodes.Length == 1))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int HSBDWD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            string _temp = "";
            int win = 0;
            int winbonus = 0;
            int ind = -1;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string mycodes = mycode[i].ToString().Trim();
                for (int j = 0; j < 3; j++)
                {
                    _code = code[j + 2].ToString().Trim();
                    ind = _temp.IndexOf(_code);
                    _temp = _temp + _code.ToString();
                    if ((mycodes.IndexOf(_code) != -1) && (ind < 0))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int OpenJJ(string caipiao_name, string codes, string buycodes)
        {
            switch (caipiao_name)
            {
                case "前三直选复式":
                    return QianSanZX(codes, buycodes);

                case "前三直选单式":
                    return QianSanZXD(codes, buycodes);

                case "中三直选复式":
                    return ZHongSanZX(codes, buycodes);

                case "中三直选单式":
                    return ZHongSanZXD(codes, buycodes);

                case "前二直选复式":
                    return QianErZX(codes, buycodes);

                case "前二直选单式":
                    return QianErZXD(codes, buycodes);

                case "前一直选":
                    return QianYiZX(codes, buycodes);

                case "后三直选复式":
                    return HouSanZX(codes, buycodes);

                case "后三直选单式":
                    return HouSanZXD(codes, buycodes);

                case "后二直选复式":
                    return HouErZX(codes, buycodes);

                case "后二直选单式":
                    return HouErZXD(codes, buycodes);

                case "后一直选":
                    return HouYiZX(codes, buycodes);

                case "前三组三":
                    return QianSanZUS(codes, buycodes);

                case "后三组三":
                    return HouSanZUS(codes, buycodes);

                case "前二组二":
                    return QianErZUE(codes, buycodes);

                case "后二组二":
                    return HouErZUE(codes, buycodes);

                case "前三值和":
                    return QianSanZHH(codes, buycodes);

                case "后三值和":
                    return HouSanZHH(codes, buycodes);

                case "前三组和":
                    return QianSanZUH(codes, buycodes);

                case "后三组和":
                    return HouSanZUH(codes, buycodes);

                case "前三组六":
                    return QianSanZUL(codes, buycodes);

                case "后三组六":
                    return HouSanZUL(codes, buycodes);

                case "前三混组":
                    return QianSanHunZU(codes, buycodes);

                case "后三混组":
                    return HouSanHunZU(codes, buycodes);

                case "个位合值":
                    return GeWeiHZ(codes, buycodes);

                case "大小单双":
                    return DaXiaoDS(codes, buycodes);

                case "前三不定位":
                    return QSBDWD(codes, buycodes);

                case "后三不定位":
                    return HSBDWD(codes, buycodes);

                case "定位胆":
                    return DWD(codes, buycodes);
            }
            return 0;
        }

        public static int QianErZUE(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            if (code[0].ToString() != code[1].ToString())
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    mycodes = mycode[i].ToString().Trim();
                    for (int j = 0; j < 2; j++)
                    {
                        _code = code[j].ToString().Trim();
                        if (mycodes.IndexOf(_code) != -1)
                        {
                            win++;
                        }
                    }
                    if (win == 2)
                    {
                        winbonus++;
                    }
                }
            }
            return winbonus;
        }

        public static int QianErZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode1 = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode1.Length; i++)
            {
                win = 0;
                string[] mycode3 = mycode1[i].ToString().Trim().Split(new char[] { ',' });
                for (int j = 0; j < mycode3.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycode3[j].ToString().Trim().IndexOf(_code) != -1) && (mycode3.Length == 2))
                    {
                        win++;
                    }
                }
                if (win == 2)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int QianErZXD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString();
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycodes.Substring(j, 1).IndexOf(_code) != -1) && (mycodes.Length == 2))
                    {
                        win++;
                    }
                }
                if (win == 2)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int QianSanHunZU(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                string singlenum = mycode[i].ToString().Trim();
                if (((singlenum.Substring(0, 1) == singlenum.Substring(1, 1)) || (singlenum.Substring(0, 1) == singlenum.Substring(2, 1))) || (singlenum.Substring(2, 1) == singlenum.Substring(1, 1)))
                {
                    win = QianSanZUS(codes, mycode[i].ToString().Trim());
                }
                else
                {
                    win = QianSanZUL(codes, mycode[i].ToString().Trim());
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int QianSanZHH(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            int zhihe = 0x63;
            zhihe = (Convert.ToInt32(code[2]) + Convert.ToInt32(code[1])) + Convert.ToInt32(code[0]);
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 4].ToString().Trim();
                    if (Convert.ToInt32(mycodes[j].ToString().Trim()) == zhihe)
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int QianSanZUH(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            int ZXHZ = 0;
            bool zuhe = false;
            bool flag = false;
            if (((Convert.ToInt32(code[0]) == Convert.ToInt32(code[1])) || (Convert.ToInt32(code[0]) == Convert.ToInt32(code[2]))) || (Convert.ToInt32(code[1]) == Convert.ToInt32(code[2])))
            {
                zuhe = true;
                ZXHZ = (Convert.ToInt32(code[2]) + Convert.ToInt32(code[1])) + Convert.ToInt32(code[1]);
            }
            if (flag)
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    string[] mycodes = mycode[i].Split(new char[] { ',' });
                    for (int j = 0; j < mycodes.Length; j++)
                    {
                        _code = code[j + 4].ToString().Trim();
                        if (Convert.ToInt32(mycodes[j].ToString().Trim()) == ZXHZ)
                        {
                            win += 3;
                        }
                    }
                    winbonus += win;
                }
            }
            if (!zuhe)
            {
                winbonus = 0;
            }
            return winbonus;
        }

        public static int QianSanZUL(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            bool zuliu = false;
            int win = 0;
            int winbonus = 0;
            if (((code[0] != code[1]) && (code[1] != code[2])) && (code[0] != code[2]))
            {
                zuliu = true;
            }
            if (zuliu)
            {
                for (int i = 0; i < mycode.Length; i++)
                {
                    win = 0;
                    mycodes = mycode[i].ToString().Trim();
                    for (int j = 0; j < 3; j++)
                    {
                        _code = code[j].ToString().Trim();
                        if (mycodes.IndexOf(_code) != -1)
                        {
                            win++;
                        }
                    }
                    if (win == 3)
                    {
                        winbonus++;
                    }
                }
            }
            if (!zuliu)
            {
                winbonus = 0;
            }
            return winbonus;
        }

        public static int QianSanZUS(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            bool zuxuan = false;
            if (((Convert.ToInt32(code[2]) == Convert.ToInt32(code[0])) || (Convert.ToInt32(code[1]) == Convert.ToInt32(code[2]))) || (Convert.ToInt32(code[1]) == Convert.ToInt32(code[0])))
            {
                zuxuan = true;
            }
            if ((Convert.ToInt32(code[2]) == Convert.ToInt32(code[0])) && (Convert.ToInt32(code[2]) == Convert.ToInt32(code[1])))
            {
                zuxuan = false;
            }
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString().Trim();
                for (int j = 0; j < 3; j++)
                {
                    _code = code[j].ToString().Trim();
                    if (mycodes.IndexOf(_code) != -1)
                    {
                        win++;
                    }
                }
                if ((win == 3) && zuxuan)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int QianSanZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode1 = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode1.Length; i++)
            {
                win = 0;
                string[] mycode3 = mycode1[i].ToString().Trim().Split(new char[] { ',' });
                for (int j = 0; j < mycode3.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycode3[j].ToString().Trim().IndexOf(_code) != -1) && (mycode3.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int QianSanZXD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString();
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycodes.Substring(j, 1).IndexOf(_code) != -1) && (mycodes.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int QianYiZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int winbonus = 0;
            int win = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string[] mycodes = mycode[i].Split(new char[] { ',' });
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j].ToString().Trim();
                    if ((mycodes[j].ToString().Trim().IndexOf(_code) != -1) && (mycodes.Length == 1))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int QSBDWD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            string _temp = "";
            int win = 0;
            int ind = -1;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                string mycodes = mycode[i].ToString().Trim();
                for (int j = 0; j < 3; j++)
                {
                    _code = code[j].ToString().Trim();
                    ind = _temp.IndexOf(_code);
                    _temp = _temp + _code.ToString();
                    if ((mycodes.IndexOf(_code) != -1) && (ind < 0))
                    {
                        win++;
                    }
                }
                winbonus += win;
            }
            return winbonus;
        }

        public static int ZHongSanZX(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode1 = buycodes.Split(new char[] { '$' });
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode1.Length; i++)
            {
                win = 0;
                string[] mycode3 = mycode1[i].ToString().Trim().Split(new char[] { ',' });
                for (int j = 0; j < mycode3.Length; j++)
                {
                    _code = code[j + 1].ToString().Trim();
                    if ((mycode3[j].ToString().Trim().IndexOf(_code) != -1) && (mycode3.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }

        public static int ZHongSanZXD(string codes, string buycodes)
        {
            string[] code = codes.Split(new char[] { ',' });
            string[] mycode = buycodes.Split(new char[] { '$' });
            string mycodes = string.Empty;
            string _code = string.Empty;
            int win = 0;
            int winbonus = 0;
            for (int i = 0; i < mycode.Length; i++)
            {
                win = 0;
                mycodes = mycode[i].ToString();
                for (int j = 0; j < mycodes.Length; j++)
                {
                    _code = code[j + 1].ToString().Trim();
                    if ((mycodes.Substring(j, 1).IndexOf(_code) != -1) && (mycodes.Length == 3))
                    {
                        win++;
                    }
                }
                if (win == 3)
                {
                    winbonus++;
                }
            }
            return winbonus;
        }
    }
}
